<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
    </head>
    <body>
        <?php
        function isLogin($_id, $_password, $_tipe) {
            include("Koneksi.php");
            $q = "select id, password from pelanggan where id=$_id";
            $rs = oci_parse($conn, $q);
            oci_execute($rs);
            $dt = oci_fetch_assoc($rs);
            if ($_tipe == "Pelanggan") {
                if ($dt["PASSWORD"] == $_password && $dt["ID"] == $_id) {
                    ?>
                    <center><h1>Selamat Datang Pelanggan<?php echo "$_id"; ?></h1>
                        <br /><a href="FormPemesanan.php?Id=<?php echo "$_id"; ?>">OK</a>						                    <center>
                            <?php
                        } else {
                            ?>
                            </p>
                            <center><h1>USERNAME ATAU PASSWORD SALAH</h1>
                                <form action="FormLogin.php" method="post">
                                    <input type="submit" value="OK" />
                                </form>
                            </center>
                            <?php
                        }
                    } else {
                        if ($_id == "12345" && $_password == "12345") {
                            header("location:FormTerimaBarang.php");
                        } else {
                            ?>
                            <center><h1>USERNAME ATAU PASSWORD SALAH</h1>
                                <form action="FormLogin.php" method="post">
                                    <input type="submit" value="OK" />
                                </form>
                            </center>
                            <?php
                        }
                    }
                }

                $id = $_POST['id'];
                $password = $_POST['password'];
                $tipe = $_POST['tipe'];
                isLogin($id, $password, $tipe);
                ?>
</body>
</html>